
#include "state.h"

static char bd_state = 0x17;
static int poweroff=0;

int get_poweroff()
{
    return poweroff;
}
void set_poweroff(int val)
{
    poweroff=val;
}

char get_sys_state() {
	return bd_state;
}

void set_sys_state(char bit, char state) {

	int tmp;
	if(state==0)
	{
		tmp=~(1<<bit);
		bd_state=bd_state&tmp;
	}
	else if(state==1)
	{
		bd_state=bd_state|(1<<bit);
	}
}

void set_sys_bit(char val)
{
	bd_state|=val;
}

void clear_sys_bit(char val)
{
	bd_state&=~val;
}
